//
//  Bundle+Extension.swift
//  demo
//
//  Created by ZWJY on 2021/8/20.
//

import Foundation

public extension Bundle{
    
    ///获取命名空间
    var nameSpace: String{
        return Bundle.main.infoDictionary?["CFBundleName"] as? String ?? ""
    }

    /// 获取app版本号
    var appVersion: String {
        return Bundle.main.infoDictionary!["CFBundleShortVersionString"] as? String ?? ""
    }
    
    /// 获取app名字
    var appName: String {
        return Bundle.main.infoDictionary!["CFBundleDisplayName"] as? String ?? ""
    }

    /// 获取app的 Bundle Identifier
    var appBundleIdentifier: String {
        return Bundle.main.bundleIdentifier ?? ""
    }
    
    ///国际化语言处理
    func ltring(for key: String) -> String {
        let value = Bundle.main.localizedString(forKey: key, value: nil, table: nil)
        return value
    }
}
